package com.heima.admin.controller.v1;

import com.heima.admin.service.AdSensitiveService;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("api/v1/sensitive")
@RestController
@Api(value = "敏感词API")
public class AdSensitiveController {

    @Autowired
    private AdSensitiveService sensitiveService;


    @ApiOperation(value = "根据条件模糊查询敏感词")
    @PostMapping("/list")
    public ResponseResult findSensitiveBYPage(@RequestBody SensitiveDto sensitiveDto) {
        return sensitiveService.findSensitiveList(sensitiveDto);
    }

    @ApiOperation(value = "新增敏感词")
    @PostMapping("/save")
    public ResponseResult addSensitive(@RequestBody AdSensitive adSensitive) {
        return sensitiveService.addSensitive(adSensitive);
    }

    @ApiOperation(value = "修改敏感词")
    @PostMapping("/update")
    public ResponseResult updateSensitive(@RequestBody AdSensitive adSensitive) {
        return sensitiveService.updateSensitive(adSensitive);
    }

    @ApiOperation(value = "根据id删除敏感词")
    @DeleteMapping("del/{id}")
    public ResponseResult deleteSensitive(@PathVariable Integer id) {
        return sensitiveService.deleteSensitive(id);
    }


}
